#ifndef LOGIN_SERVER_H
#define LOGIN_SERVER_H

#include<nlohmann/json.hpp>
#include"../net/campus_wss_server.h"
#include"../login/campus_login_define.h"
#include"../person_info/campus_person_info_define.h"
#include"../club_info/campus_club_info_define.h"
#include"../live_info/campus_live_info_define.h"

using json = nlohmann::json;

#define CAMPUS_WHOLE_SERVER_PORT 9004

class CampusWholeServer:public CampusWssServer
{

public:
    static CampusWholeServer* getInstance();
    static void setLoginObserver(CampusLoginServerObserver* observer);
    static void setPersonInfoObserver(CampusPersonInfoObserver* observer);
    static void setClubInfoObserver(CampusClubInfoObserver* observer);
    static void setLiveObserver(CampusLiveInfoObserver* observer);

protected:
    virtual void on_open(server *s, websocketpp::connection_hdl hdl) override;
    virtual void on_close(server *s, websocketpp::connection_hdl hdl) override;
    virtual void on_message(server *s, websocketpp::connection_hdl hdl, message_ptr msg) override;
    virtual void on_fail(websocketpp::connection_hdl hdl) override;

private:
    virtual ~CampusWholeServer() override;

    CampusWholeServer(int port = CAMPUS_WHOLE_SERVER_PORT);
private:
    static CampusLoginServerObserver* login_observer_;
    static CampusPersonInfoObserver* person_info_observer_;
    static CampusClubInfoObserver* club_info_observer_;
    static CampusLiveInfoObserver* live_observer_;
};

#endif